/**
 * Copyright (C), 2015-2019, XXX有限公司
 * FileName: DecoratorClient
 * Author:   zhouheng
 * Date:     2019/5/2 22:11
 * Description: 装饰模式客户端
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.zhouh.patterns.com.zhouh.structure.decorator;

import com.zhouh.patterns.com.zhouh.create.factory.abstractFactory.AbstractFactory;
import com.zhouh.patterns.com.zhouh.create.factory.abstractFactory.AppleFactory;
import com.zhouh.patterns.com.zhouh.entity.Bag;
import com.zhouh.patterns.com.zhouh.entity.bag.OrangeBag;

/**
 * 〈给对象新增其他功能〉<br>
 * 〈装饰模式客户端〉
 *
 * @author zhouheng
 * @create 2019/5/2
 * @since 1.0.0
 */
public class DecoratorClient {
    public static void main(String[] args){
//        Bag bag = new OrangeBag();
//        BagDecorator bagDecorator = new SpeedDecorator(bag);
//        bagDecorator.pack();

        AbstractFactory factory = new AppleFactory();
        Bag bag = factory.getBag();
        bag = new CheckedBagDecorator(bag);//防伪功能
        bag = new ReinforceBagDecorator(bag);//加固功能
        bag = new SpeedDecorator(bag);//加急功能

        bag.pack();
    }
}